package myschool.test;

import myschool.dao.ExamDao;
import myschool.entity.ExamResult;
import myschool.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class ExamAdd {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd H:mm:ss");
        Date d=df.parse("2023-4-27 15:0:0");
        SqlSession s= MyBatisUtil.get();
        ExamDao mapper = s.getMapper(ExamDao.class);
         ExamResult exam=new ExamResult();
         exam.setScore(100);
         exam.setExamDate(d);
         exam.setSbid(48L);
         exam.setStid(15L);
         mapper.add(exam);
        System.out.println("新成绩的id是："+exam.getId());
        MyBatisUtil.close(s);
    }
}
